function [simout msg] = runtest(model,setSystem,tcFile,logVars)
simout = '';
msg = [];
% load test case data ,return a struct TC.
load(tcFile);

pos = strfind(tcFile,'\');
tcFile = tcFile(pos(end)+1:end);

evalin('base','clear TC');
assignin('base','TC',TC);
simtime = TC.simtime;
% simulation module
  ConfigSet = getActiveConfigSet(model(1:end-4));
  set_param(ConfigSet,'SolverType','Fixed-step' ...
                    ,'FixedStep','0.01' ...
                    ,'Solver','ode3' ...
                    ,'StopTime',num2str(simtime));
  try 
		% loggging on expect vars
    setlogging(logVars,setSystem,'on'); 
		
    simout = sim(model,'SaveOutput','on','SaveFormat','StructureWithTime');	
    
		disp(['Running ' tcFile(1:end-4) ' finished']);
		
    % remove logging set  
    setlogging(logVars,setSystem,'off'); 
    
	catch exception
    disp(exception.message)
    msg = exception.message;
    return;
  end
%    simout = simOut.get('logsout');